<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
     var data=[
         [1,2,3,4],
         [5,6,7,8],
         [9,10,11,12]
     ]
     var arr = [];

     for (var i=0;i<data[0].length;i++){
                for (var k =0; k<data.length; k++){
                         arr[i][k] = data[k][i];
                }
     }
     // for (let index = 0;index<4;index++){
     //       arr.push(data.map(v=>v[index]))
     // }
     console.log(arr);
</script>
</body>
</html>